package com.xiaoqi.store.controller;

import com.xiaoqi.store.entity.DistrictsEntity;
import com.xiaoqi.store.entity.JsonResult;
import com.xiaoqi.store.service.DistrictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author Rookie Coder
 * @Description 省市区三级联动
 * @Date
 **/
@RestController
public class DistrictController extends BaseController{

    @Autowired
    private DistrictService districtService;

    /*
    * @Author xiaoqi
    * @Description  省市区三级联动查询
    * @return
    **/
    @GetMapping("/districts")
    public JsonResult<List<DistrictsEntity> > getALlDistricts(String parent){
        List<DistrictsEntity> allDistricts = districtService.getAllDistricts(parent);
        return new JsonResult<List<DistrictsEntity>>(OK,allDistricts);
    }


}
